import { asyncRoutes } from '@/router'
const state = {
  routes: []
}
const mutations = {
  setRoutes(state, newRoutes) {
    state.routes = newRoutes
  }
}
const actions = {
  filterRoutes(store, menus) {
    console.log(asyncRoutes)
    const newRoutes = asyncRoutes.filter(item => {
      return menus.includes(item.name)
    })
    store.commit('setRoutes', newRoutes)
    return newRoutes
  }
}
export default {
  namespaced: true,
  state,
  mutations,
  actions
}
